home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 982 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What wrong with this code ??????
  5. Date: Wed, 10 Jan 96 15:38:22 GMT
  6. Organization: none
  7. Message-ID: <821288302snz@genesis.demon.co.uk>
  8. References: <4bjl81$qiu@wumpus.cc.uow.edu.au> <JARNOT.96Jan9145744@box10.dstar.iddis.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <JARNOT.96Jan9145744@box10.dstar.iddis.com>
  15.            jarnot@iddis.com "Kevin J. Jarnot" writes:
  16.  
  17. >You should have an interesting value stored in c!  BTW, this is
  18. >valid C code, although you'll get a warning about mixing pointers
  19. >and integers.
  20.  
  21. getchar evaluates to a pointer to a function. This cannot be legally
  22. assigned to an integer in C (it violates a constraint and hence a
  23. diagnostic is required).
  24.  
  25. In comparison casting a pointer to an integer results in implementation-
  26. defined behaviour. However you're no better off as far as portability is
  27. concerned since the implementation could make the behaviour undefined by
  28. stating that no integer is big enough to hold the result. The compiler
  29. doesn't have to generate a diagnostic however.
  30.  
  31. -- 
  32. -----------------------------------------
  33. Lawrence Kirby | fred@genesis.demon.co.uk
  34. Wilts, England | 70734.126@compuserve.com
  35. -----------------------------------------
  36.